package abq2.jic.jic.plugin.other.other.mob.mob;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.serialization.SerializationUtils;
import kd.bos.form.ClientMethod;
import kd.bos.form.control.Button;
import kd.bos.form.control.QRCode;
import kd.bos.form.events.CustomEventArgs;
import kd.bos.form.plugin.AbstractMobFormPlugin;
import kd.bos.mvc.form.MobileFormView;
import kd.bos.openapi.base.util.DynamicObjectUtil;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import org.json.JSONObject;

import java.util.EventObject;
import java.util.HashMap;

public class BookMobCodePlugin extends AbstractMobFormPlugin {
    @Override
    public void afterBindData(EventObject e) {
        super.afterBindData(e);
        // 过滤状态，可借阅
        QFilter numberFilter = new QFilter("kdec_billstatusfield", QCP.equals, "A");
        // 取出一条数据，取出可以借阅的数据
        DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("kdec_book_all",
                "id, name, number, kdec_author, kdec_billstatusfield", numberFilter.toArray());
        String content = SerializationUtils.toJsonString(dynamicObject);
        QRCode qrCode = getControl("kdec_qrcodeap");
        qrCode.setUrl(content);
    }
}
